/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package basico.b01;

import java.awt.*;
import java.awt.event.*;

public class OlaMundo2 extends Frame {
    public static void main (String [] argv){
	OlaMundo2 h = new OlaMundo2();
    }

    public OlaMundo2(){
	setTitle("Olá Mundo!");		
	setSize(300, 250);

	Panel hello = new Panel();
	add("Center", hello);

	Button button = new Button("OK");
	add("South", button);
	button.addActionListener(new ActionListener() {
            @Override
	    public void actionPerformed(ActionEvent e) {
		System.exit(0);
	    }
	});

	setVisible(true);

	int width = hello.getWidth();
	int height = hello.getHeight();
	Graphics g = hello.getGraphics();
	g.drawString("Olá Mundo em Modo Gráfico!", width/2 - 25, height/2);

	addWindowListener(new WindowAdapter(){
	    public void windowClosing(WindowEvent e){ 
		System.exit(0);
	    }
	});

    }
}